#ifndef __PID_ALGORITHM_H__
#define __PID_ALGORITHM_H__

#ifdef __cplusplus
extern "C" {
#endif

struct x_pid_algorithm_params {
    double kp, ki, kd;
    double set_point;
    double current_point;
    double e[3]; /* e(k), e(k-1), e(k-2) */
    double u[3]; /* u(k), u(k-1) , u(k-2)*/
    double max_u, min_u;
    unsigned long sample_period;/* ms */
};

extern unsigned long simple_discrete_pid_algorithm (struct x_pid_algorithm_params *pparams);
extern unsigned long discrete_pid_algorithm_type_a (struct x_pid_algorithm_params *pparams);
extern unsigned long classic_discrete_pid_algoritm (struct x_pid_algorithm_params *pparams);

#ifdef __cplusplus
}
#endif
#endif // __PID_ALGORITHM_H__